package com.project.controller;


import com.project.entity.UserEntity;
import com.project.token.TokenSys;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@Api(tags = "登录验证token")
@RequestMapping("boot")
public class LoginController {

    @ApiOperation(value = "登录系统返回token")
    @PostMapping("login")
    public String login(UserEntity user) {
        if (user.getUserName().equals("zy") && user.getPwd().equals("123")) {
            System.out.println(user.getUserName()+"->"+user.getPwd());
            return TokenSys.createToken("/boot/power1/boot/power2");
        }
        return "";
    }


    @GetMapping("power1")
    public String power1(){
        return "power1";
    }

    @GetMapping("power2")
    public String power2(){
        return "power2";
    }

    @GetMapping("power3")
    public String power3(){
        return "power3";
    }


}

